//统一接口管理

import request from "@/request/request.js"
import qs from 'qs'

//请求精品推荐数据   ==>这里要写成函数的形式，不然页面会访问全部接口
export const JingPinAPI = () => request.get('/products/recommend');

//请求热门兑换/products/hot
export const HotAPI = () => request.get('/products/hot');

//商品详情请求/products/{id}
export const GoodDetailsAPI = (id) => request.get(`/products/${id}`);

//发送短信验证码请求
export const SendSMSAPI = (params) => request.post("/sendSMS", qs.stringify(params));

//手机号验证码登录
export const PhoneReginAPI = (params) => request.post("/phoneRegin", qs.stringify(params));

//微信扫码登录
export const WeixinLoginAPI = (params) => request.post("/wechatUsers/PCLogin", qs.stringify(params));

// 微信绑定手机/wechatUsers/binding
export const BindingAPI = (params) => request.post("/wechatUsers/binding", qs.stringify(params));

//获取用户信息/shop/userProfiles
export const UserProfilesAPI = () => request.get('/shop/userProfiles');

//添加到购物车请求/shop/carts/add
export const AddAPI = (params) => request.post("/shop/carts/add", qs.stringify(params));

//全部商品/products
export const ProductsAPI = (params) => request.get('/products', { params });

//查看购物车/shop/carts
export const CartsAPI = () => request.get("/shop/carts");

//购物车信息删除/shop/carts?productIds={id}
export const DelAPI = (id) => request.delete(`/shop/carts?productIds=${id}`);